import request from '@/utils/request'
import { HospitalResponseData, HospitalLevelAndRegionResponseData, HospitalInfo } from './type'

enum API {
    // 医院数据
    HOSPITAL_URL = 'hosp/hospital/',
    // 医院等级或者医院地区数据
    HOSPITALLEVELANDREGION_URL = '/cmn/dict/findByDictCode/',
    // 根据医院名字搜索医院数据
    HOSPITALINFO_URL = 'hosp/hospital/findByHosname/'
}

// 获取医院数据
export const reqHospital = (page: number, size: number, hostype: string, districtCode: string) => request.get<any, HospitalResponseData>(API.HOSPITAL_URL + `${page}/${size}?hostype=${hostype}&districtCode=${districtCode}`)

// 获取医院的等级或者获取医院地区的数据
export const reqHospitalLevelAndRegion = (dictCode: string) => request.get<any, HospitalLevelAndRegionResponseData>(API.HOSPITALLEVELANDREGION_URL + dictCode)

// 根据医院名字搜索医院数据
export const reqHospitalInfo = (hosname: string) => request.get<any, HospitalInfo>(API.HOSPITALINFO_URL + hosname)